package com.dingxin.ship_together_api.entity.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * Author: ctj
 * Date: 2022-09-27
 * Time: 16:49
 */
@Getter
@AllArgsConstructor
public enum RouteTypeEnum {
    /** 航线类型*/

    /** 拼船航线*/  SPELL_SEATS(0,"拼船航线"),
    /** 包船航线*/  All_SEATS(1,"包船航线");
    /**
     * 类型码
     */
    private Integer code;
    /**
     * 类型信息
     */
    private String typeName;
    /**
     * 根据code获取枚举
     */
    public static RouteTypeEnum getEnumByCode(Integer code) {
        for (RouteTypeEnum routeTypeEnum : RouteTypeEnum.values()) {
            if (routeTypeEnum.getCode().equals(code)) {
                return routeTypeEnum;
            }
        }
        return null;
    }
}
